from typing import List


class Solution:
    def isPrefixString(self, s: str, words: List[str]) -> bool:
        now = ""
        for word in words:
            now += word
            if now == s:
                return True
        return False


if __name__ == "__main__":
    print(Solution().isPrefixString(s="iloveleetcode", words=["i", "love", "leetcode", "apples"]))  # True
    print(Solution().isPrefixString(s="iloveleetcode", words=["apples", "i", "love", "leetcode"]))  # False
